package com.lixy.demo.springcloud.ch3_4.controller;

import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import org.springframework.web.client.RestTemplate;

import org.springframework.beans.factory.annotation.Autowired;

import com.lixy.demo.springcloud.ch3_4.vo.User;

@RestController
public class MovieController {

	@GetMapping("/user/{id}")
	public User findById( @PathVariable Long id ) {
		return this.template.getForObject( "http://localhost:8000/" + id, User.class );
	}
	
	@Autowired
	private RestTemplate template;
}
